<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #big {
            width: 200px;
            height: 200px;
            border: 1px solid #bbb;
            margin: 10px auto;
            position: relative;
            background-color: black;
        }

        #small {
            width: 150px;
            height: 150px;
         
            position: absolute;
            left: 0;
            top: 0;
            right: 0;
            bottom: 0;
            margin: auto;
            background-color: black;
            color: #fff;
        

        }
    </style>
</head>

<body>
    <div id="big" onmouseover="color()" onmouseout="message()">
        <div id="small">鼠标移入变色</div>
    </div>
    <script>
        function arr(){
            console.log(this.location);
        }
        arr()
        var arr = document.getElementById("big")
        var sm = document.getElementById("small")
        function color() {
            arr.style.backgroundColor = "red"
            sm.style.backgroundColor = "cornsilk"
            sm.style.color = "#f00"

        }
        function message() {
            arr.style.backgroundColor = "#ffffff"
            sm.style.backgroundColor = "#ffffff"
            sm.style.color = "#fff"
        }
    </script>
</body>

</html>